package com.hgyc.mom.eam.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hgyc.mom.eam.mapper.EamCheckMaintainPlanEquipmentMapper;
import com.hgyc.mom.eam.entity.EamCheckMaintainPlanEquipment;
import com.hgyc.mom.eam.service.EamCheckMaintainPlanEquipmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import com.hgyc.mom.common.exception.BizException;
import org.springframework.util.CollectionUtils;

/**
 * 设备点检保养计划设备信息Service业务层实现
 *
 * @author fwj
 * @since 2025-08-13
 */
@Slf4j
@Service
public class EamCheckMaintainPlanEquipmentServiceImpl extends ServiceImpl<EamCheckMaintainPlanEquipmentMapper, EamCheckMaintainPlanEquipment> implements EamCheckMaintainPlanEquipmentService {

    @Override
    public List<EamCheckMaintainPlanEquipment> getByParentId(Long parentId) {
        LambdaQueryWrapper<EamCheckMaintainPlanEquipment> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(EamCheckMaintainPlanEquipment::getPlanId, parentId);
        return list(wrapper);
    }

    @Override
    public void deleteByParentId(Long parentId) {
        LambdaQueryWrapper<EamCheckMaintainPlanEquipment> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(EamCheckMaintainPlanEquipment::getPlanId, parentId);
        remove(wrapper);
    }

    @Override
    public void deleteBatchByParentIds(List<Long> parentIds) {
        LambdaQueryWrapper<EamCheckMaintainPlanEquipment> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(EamCheckMaintainPlanEquipment::getPlanId, parentIds);
        remove(wrapper);
    }
}
